package com.dz.customer.service.impl;

import com.dz.common.constants.CodeDomain;
import com.dz.customer.domain.entity.User;
import com.dz.customer.domain.repository.UserRepository;
import com.dz.customer.service.UserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

/**
 * @ClassName : UserServiceImpl
 * @Description :
 * @Author : ming
 * @Date: 2021-03-06 14:27
 **/
@Service
public class UserServiceImpl implements UserService {
    @Autowired
    private UserRepository userRepository;

    @Override
    public User findById(Long id) {
        return userRepository.findByIdAndDeleteFlag(id, Integer.valueOf(CodeDomain.DELETE_FLAG_NO.value()));
    }

    @Override
    public User findByPhone(String phone) {
        return userRepository.findByPhoneAndDeleteFlag(phone,Integer.valueOf(CodeDomain.DELETE_FLAG_NO.value()));
    }
}
